package com.example.city_home_app.Fragment;

import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.example.city_home_app.Activity.UserInfoActivity;
import com.example.city_home_app.Bean.Down_UserInfo;
import com.example.city_home_app.R;
import com.example.city_home_app.UI.UIUtils;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.Unbinder;

public class Fragment_userinfo_info extends BaseFragment {
    @BindView(R.id.tv_userinfo_gender)
    TextView tvUserinfoGender;
    @BindView(R.id.tv_userinfo_city)
    TextView tvUserinfoCity;
    @BindView(R.id.tv_userinfo_email)
    TextView tvUserinfoEmail;
    @BindView(R.id.tv_userinfo_regtime)
    TextView tvUserinfoRegtime;
    Unbinder unbinder;

    private Down_UserInfo down_userInfo;
    private UserInfoActivity instance;

    @Override
    protected void init(View view) {
        unbinder = ButterKnife.bind(this, view);
        instance = (UserInfoActivity) getActivity();
    }

    @Override
    protected void initData(Bundle savedInstanceState) {
        down_userInfo = instance.getUserInfo();
        tvUserinfoCity.setText(down_userInfo.getCity_name());
        tvUserinfoEmail.setText(down_userInfo.getUser_email());
        if(down_userInfo.getUser_gender()==1){
            tvUserinfoGender.setText("男");
        }else{
            tvUserinfoGender.setText("女");
        }
        tvUserinfoRegtime.setText(UIUtils.removeTime(down_userInfo.getUser_regtime()));
    }

    @Override
    protected int getContentLayoutId() {
        return R.layout.fragment_userinfo_info;
    }


    @Override
    public void onDestroyView() {
        super.onDestroyView();
        unbinder.unbind();
    }
}
